//
//  AlipayViewC.m
//  WHSport
//
//  Created by ccjoy-jimneylee on 15/5/29.
//  Copyright (c) 2015年 jimneylee. All rights reserved.
//

#import "AlipayViewC.h"
#import "NSData+Base64.h"

@interface AlipayViewC ()
@property (weak, nonatomic) IBOutlet UIWebView *ibWebView;
@end

@implementation AlipayViewC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"支付宝页面";
    // Do any additional setup after loading the view.
    self.ibWebView.delegate = self;
    NSString *money = [self.reciveDic objectForKey:@"money"];
    NSString *num = [self.reciveDic objectForKey:@"OrderNum"];
    NSString *sub = [self.reciveDic objectForKey:@"Subject"];
    NSString *bode = [self.reciveDic objectForKey:@"Body"];
    NSURL *url = [NSURL URLWithString: @"http://192.168.0.187:8080/hhw-api/qr.jsp"];
    NSString *body = [NSString stringWithFormat: @"Body=%@&OrderNum=%@&Subject=%@&money=%@",
                      bode,num,sub,money];
//    NSString *all = [NSString stringWithFormat:@"http://192.168.0.187:8080/hhw-api/qr.jsp?Body=%@&OrderNum=%@&Subject=%@&money=%@",bode,num,sub,money];
//    NSURL *url = [NSURL URLWithString:all];
     NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url];
    [request setHTTPMethod: @"POST"];
    NSData *strdata = [body
                      dataUsingEncoding:NSUTF8StringEncoding];
    NSString *base64Encoded = [strdata base64EncodedStringWithOptions:0];
    NSData *newdata = [NSData dataFromBase64String:base64Encoded];
    [request setHTTPBody: self.data];
    [self.ibWebView loadRequest:request];
}

- (void)didReceiveMemoryWarning {
    
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
